package ca.concordia.soen6011.tests;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import ca.concordia.soen6011.Result;
import ca.concordia.soen6011.exceptions.InfinityOutputException;
import ca.concordia.soen6011.exceptions.UndefinedOutputException;
import ca.concordia.soen6011.impl.Cos;
import ca.concordia.soen6011.interfaces.MathFunction;

public class TestCos {
	
	private  MathFunction f;
	
	@Before
	public void setUp(){
		f = new Cos();
	}
	
	@Test
	public void doTest(){
		
		Result r = new Result();
		
		try {
			r = f.compute(0, 2);
			assertEquals(1, r.getOutput(), r.getPrecision());
			
			r = f.compute(Math.E,1);		
		    assertEquals(0.9, r.getOutput(), r.getPrecision());
			
			r = f.compute(180,1);		
		    assertEquals(-1, r.getOutput(), r.getPrecision());
			
		} catch (InfinityOutputException | UndefinedOutputException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		
		
		
		
	}
	//commit !!
	//Commit

}
